﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Models.Addresses>" %>
<%@ Import Namespace="CRM.Models" %>
<%@ Import Namespace="CRM.Resourses" %>



<%
    
    ViewContext.Writer.Write("<table>");

                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerType);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().ComboBox(s =>
                                                                                                                   {
                                                                                                                       s.Name = "IdAddressesType";
                                                                                                                       s.Properties.TextField = "LocaLizedString";
                                                                                                                       s.Properties.ValueField = "Id";
                                                                                                                       s.Properties.ValueType = typeof(int);
                                                                                                                   }).BindList(DB.GetLocalizedAddressesTypesNames()).Bind( Model.IdAddressesType).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");

                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerLegalEntity);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().ComboBox(s =>
                                                                                    {
                                                                                        s.Name = "IdLegalEntity";
                                                                                        s.Properties.TextField = "Name";
                                                                                        s.Properties.ValueField = "IdLegalEntity";
                                                                                        s.Properties.ValueType = typeof(int);
                                                                                    }).BindList(Model.LegalEntities).Bind( Model.IdLegalEntity).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");

                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerZipCode);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().TextBox(ss =>
                                                                                    { ss.Name = "ZipCode"; }).Bind(Model.ZipCode).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");


                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerCountry);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");



                                                                                    Html.RenderPartial("Country", Model.Settlements);


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");


                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerRegion);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    //                                                                          
                                                                                    Html.RenderPartial("profineRegion", Model.Settlements);

                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");


                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerDistrict);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");




                                                                                    //                                                                              

                                                                                    Html.RenderPartial("Region", Model.Settlements);

                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");

                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerCity);
                                                                                    ViewContext.Writer.Write("</th>");


                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.RenderPartial("City", Model.Settlements);

                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");



                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerStreet);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().TextBox(ss =>
                                                                                    { ss.Name = "Street"; }).Bind(Model.Street).GetHtml(); 


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");


                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerHouse);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().TextBox(ss =>
                                                                                    { ss.Name = "House"; }).Bind(Model.House).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");

                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerPhone);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().TextBox(ss =>
                                                                                    { ss.Name = "Phone"; }).Bind(Model.Phone).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");


                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.customerFax);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().TextBox(ss =>
                                                                                    { ss.Name = "Fax"; }).Bind(Model.Fax).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");


                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.Comments);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().Memo(ss =>
                                                                                    { ss.Name = "Comments"; }).Bind(Model.Comments).GetHtml();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");



                                                                                    ViewContext.Writer.Write("<tr><th>");
                                                                                    ViewContext.Writer.Write(Resourses.IsPrimary);
                                                                                    ViewContext.Writer.Write("</th>");
                                                                                    ViewContext.Writer.Write("<td>");

                                                                                    Html.DevExpress().CheckBox(ss =>
                                                                                    { ss.Name = "IsPrimary"; }).Bind(Model.IsPrimary).GetHtml();
                                                                                        


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");

                                                                                    ViewContext.Writer.Write("<tr><td>");


                                                                                    Html.DevExpress().HyperLink(hsett =>
                                                                                    {
                                                                                        hsett.Name = "hyperlnk";
                                                                                        hsett.Properties.ClientSideEvents.Click = "function(s, e){ gdAddresses.UpdateEdit(); }";
                                                                                        // hsett.NavigateUrl = "#";
                                                                                        hsett.Properties.Text = Resourses.Save;
                                                                                    }).Render();


                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("<td>");


                                                                                    Html.DevExpress().HyperLink(hsett =>
                                                                                    {
                                                                                        hsett.Name = "hyperlsank";
                                                                                        hsett.Properties.ClientSideEvents.Click = "function(s, e){ gdAddresses.CancelEdit(); }";
                                                                                        //  hsett.NavigateUrl = "#";
                                                                                        hsett.Properties.Text = Resourses.Cancel;
                                                                                    }).Render();



                                                                                    ViewContext.Writer.Write("</td>");
                                                                                    ViewContext.Writer.Write("</tr>");

                                                                                    ViewContext.Writer.Write("</table>");
     %>